package com.amap.business.controller;

import com.amap.builder.BizResponse;
import com.amap.business.request.GetProductPriceRequest;
import com.amap.manager.BusinessHandlerManager;
import com.amap.template.AmapServiceTemplate;
import com.amap.utils.BeanUtils;
import com.mssdk.event.annotation.AutomaticallyAddEvents;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuyi
 * @since 2025/11/3 16:54
 */

@RequestMapping({"/gasstation"})
@RestController
@RequiredArgsConstructor
public class GasStationController {
    private final AmapServiceTemplate amapServiceTemplate;
    private final BusinessHandlerManager businessHandlerManager;

    @RequestMapping({"/getProductPrice"})
    @AutomaticallyAddEvents
    public BizResponse getProductPrice(GetProductPriceRequest request) {
        request.setMethod("amap.gasstation.getProductPrice");
        return this.amapServiceTemplate.processRequest(businessHandlerManager.getBusinessHandler("getProductPriceHandler"), BeanUtils.beanToMap(request));
    }
}
